<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
  <title>Document</title>
</head>
<body>
 
  <button id="click">点击</button>
  <button id="destroy">销毁</button>
</body>
<script>
  const domClick=document.querySelector("#click")
  const destroyClick = document.querySelector("#destroy")
  let lists=[]
  function createArray(){
    let array =new Array(1024*1024).fill(1);
    return function(){
      console.log(array);
    }
  }
  domClick.onclick=function(){
    for(let i=0;i<100;i++){
      lists.push(createArray())
    }
    console.log(lists.length);
  }
  
  destroyClick.onclick = function () {
      lists = [] //释放内存
  }
</script>
</html>